import nock from "nock";

nock("https://matej10qa.appwrite.org:443", { encodedQueryParams: true })
    .post("/v1/account/sessions/anonymous", {})
    .reply(
        201,
        [
            "1f8b0800000000000003758f4b4fc3301084ff0a8a7a83467ea469925b4145e2400f28704fec0db5dadad1daa98810ff1db70979a8e2647b66f79bf177b05032c88298b3682d78043c8e09adca2a4aaae021580884c281dc383fc308634b922e699c539ef175b68ac39427f7846484f8e1c602becc602c912c29d92a95d2fbf0552b840ec46f417400d568ce4a02fad1421bdd9e4c6327f2fbb5f144d80801d6e6e600fa5f637b096fe7f61b5408763f5954b53fe92a0d691487110dd9a58eb14f46423760ecae380df70f40ab4cbf2b8e0ab4cbdbfa621f558985cffb934742f7ee293b2fdf3d8313fbc11999342483bad59f4acf089d326b20e1ac048c05bbf723165a4e85571f7aec51a6d10edbbe9dc351ea29798307b87ea341f4a941e6b0819f5f80aa49fe37020000",
        ],
        [
            "Access-Control-Allow-Credentials",
            "true",
            "Access-Control-Allow-Headers",
            "Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-Appwrite-ID, Content-Range, Range, Cache-Control, Expires, Pragma",
            "Access-Control-Allow-Methods",
            "GET, POST, PUT, PATCH, DELETE",
            "Access-Control-Allow-Origin",
            "https://localhost",
            "Access-Control-Expose-Headers",
            "X-Fallback-Cookies",
            "Content-Encoding",
            "gzip",
            "Content-Length",
            "300",
            "Content-Type",
            "application/json; charset=UTF-8",
            "Date",
            "Fri, 16 Sep 2022 13:37:56 GMT",
            "Server",
            "Appwrite",
            "Set-Cookie",
            "a_session_6324555073b9706cb1f5_legacy=eyJpZCI6IjYzMjQ3YzM0ZTI4ZDI4YjI1OWRkIiwic2VjcmV0IjoiMjgyYTUyYWQwZjIzYzU2ZmMzOTU5YjhlOTMxYTBmM2VhODU2OWY4YzJlNmJjMDkxZDg4MTE2NzhiZDQ4ODUxOGQ1ODhiNmFiMGY1YTE0NjMwZjIwYWYyNmM2OGNmZDk3ZTMzNThhMjk0MTg3M2Q3YjkzZmJhMjExZjM0M2I1ODAxOGQxY2U5Yjk2MDgxZDAwYTVlYzQwNDk2ZTQ0OTk5Mzk1NGFlZmIwYTEyNDIxNjRlYmRkMGJlNDA5MjZmYTkyZmUzNjdjNzJlMzM3YWU5ZTY0YjM1N2UzZTg5ZWVmZTk4YjA4OTdmMDJiZjdmZmIyZjFjZWFmODBmYzYzNmIxYSJ9; expires=Sat, 16-Sep-2023 13:37:56 GMT; path=/; domain=.matej10qa.appwrite.org; secure; httponly",
            "Set-Cookie",
            "a_session_6324555073b9706cb1f5=eyJpZCI6IjYzMjQ3YzM0ZTI4ZDI4YjI1OWRkIiwic2VjcmV0IjoiMjgyYTUyYWQwZjIzYzU2ZmMzOTU5YjhlOTMxYTBmM2VhODU2OWY4YzJlNmJjMDkxZDg4MTE2NzhiZDQ4ODUxOGQ1ODhiNmFiMGY1YTE0NjMwZjIwYWYyNmM2OGNmZDk3ZTMzNThhMjk0MTg3M2Q3YjkzZmJhMjExZjM0M2I1ODAxOGQxY2U5Yjk2MDgxZDAwYTVlYzQwNDk2ZTQ0OTk5Mzk1NGFlZmIwYTEyNDIxNjRlYmRkMGJlNDA5MjZmYTkyZmUzNjdjNzJlMzM3YWU5ZTY0YjM1N2UzZTg5ZWVmZTk4YjA4OTdmMDJiZjdmZmIyZjFjZWFmODBmYzYzNmIxYSJ9; expires=Sat, 16-Sep-2023 13:37:56 GMT; path=/; domain=.matej10qa.appwrite.org; secure; httponly; samesite=None",
            "X-Content-Type-Options",
            "nosniff",
            "X-Debug-Fallback",
            "true",
            "X-Debug-Speed",
            "0.023267030715942",
            "X-Fallback-Cookies",
            '{"a_session_6324555073b9706cb1f5":"eyJpZCI6IjYzMjQ3YzM0ZTI4ZDI4YjI1OWRkIiwic2VjcmV0IjoiMjgyYTUyYWQwZjIzYzU2ZmMzOTU5YjhlOTMxYTBmM2VhODU2OWY4YzJlNmJjMDkxZDg4MTE2NzhiZDQ4ODUxOGQ1ODhiNmFiMGY1YTE0NjMwZjIwYWYyNmM2OGNmZDk3ZTMzNThhMjk0MTg3M2Q3YjkzZmJhMjExZjM0M2I1ODAxOGQxY2U5Yjk2MDgxZDAwYTVlYzQwNDk2ZTQ0OTk5Mzk1NGFlZmIwYTEyNDIxNjRlYmRkMGJlNDA5MjZmYTkyZmUzNjdjNzJlMzM3YWU5ZTY0YjM1N2UzZTg5ZWVmZTk4YjA4OTdmMDJiZjdmZmIyZjFjZWFmODBmYzYzNmIxYSJ9"}',
            "X-Ratelimit-Limit",
            "50",
            "X-Ratelimit-Remaining",
            "14",
            "X-Ratelimit-Reset",
            "1663336800",
            "Connection",
            "close",
        ],
    );

nock("https://matej10qa.appwrite.org:443", { encodedQueryParams: true })
    .post(
        "/v1/databases/632455a0b8d017403ce9/collections/632455a55dc72e1aa016/documents",
        {
            documentId: "unique()",
            data: { title: "Test 1" },
            permissions: ['read("any")', 'write("any")'],
        },
    )
    .reply(
        201,
        [
            "1f8b08000000000000038d8fbd0a023110845f45160bc51f761373d17496f6766a914b5608c4f3b8c442c4773741842b2d776676bedd17e49023838123a73c2158c234f83236526cb4938aaea8589068afb2ad66cfc32da414ee5d02738281ad9f9dc176cf33cc8bffe8bdcd3c563c471e2b9752e2ca5a66bfcf0524508815ee56d41c491aa98dd26b127a8168102bf15bf95fd8737243e873390f4cf788b1c2ee31b2abd2e1f798525629efb460b216a9a99802b1ad4d3c0e61bbf5487a83d2f10ede1fe57bcc622d010000",
        ],
        [
            "Access-Control-Allow-Credentials",
            "true",
            "Access-Control-Allow-Headers",
            "Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-Appwrite-ID, Content-Range, Range, Cache-Control, Expires, Pragma",
            "Access-Control-Allow-Methods",
            "GET, POST, PUT, PATCH, DELETE",
            "Access-Control-Allow-Origin",
            "https://localhost",
            "Access-Control-Expose-Headers",
            "X-Fallback-Cookies",
            "Content-Encoding",
            "gzip",
            "Content-Length",
            "204",
            "Content-Type",
            "application/json; charset=UTF-8",
            "Date",
            "Fri, 16 Sep 2022 13:37:57 GMT",
            "Server",
            "Appwrite",
            "X-Content-Type-Options",
            "nosniff",
            "X-Debug-Fallback",
            "true",
            "X-Debug-Speed",
            "0.010862112045288",
            "X-Ratelimit-Limit",
            "120",
            "X-Ratelimit-Remaining",
            "119",
            "X-Ratelimit-Reset",
            "1663335480",
            "Connection",
            "close",
        ],
    );

nock("https://matej10qa.appwrite.org:443", { encodedQueryParams: true })
    .post(
        "/v1/databases/632455a0b8d017403ce9/collections/632455a55dc72e1aa016/documents",
        {
            documentId: "unique()",
            data: { title: "Test 2" },
            permissions: ['read("any")', 'write("any")'],
        },
    )
    .reply(
        201,
        [
            "1f8b08000000000000038d8f316f02310c85ff0ab2188a5a2ac72197231b637736e8908b3d440ac7e9120684f8ef4d84906eece8f79edf673fa0c492041c1c259715c117ac23d7b1d3b4b3411bc27e187a62a6d0377392f912738ed731833bc12c9e3fcee0c7fb1936d5bf4dec8b2c1596244be5b79684ba56840fa5820889b6b8dfaaeea8b4d3d619fbadb4fe4474888df8aafc5f982587394ea59e076ebca5d460d7942434e9e7fd9831de180e9644798faa6b980af183cfb20ce1d0332abb431d640fcf3f4fa0db032d010000",
        ],
        [
            "Access-Control-Allow-Credentials",
            "true",
            "Access-Control-Allow-Headers",
            "Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-Appwrite-ID, Content-Range, Range, Cache-Control, Expires, Pragma",
            "Access-Control-Allow-Methods",
            "GET, POST, PUT, PATCH, DELETE",
            "Access-Control-Allow-Origin",
            "https://localhost",
            "Access-Control-Expose-Headers",
            "X-Fallback-Cookies",
            "Content-Encoding",
            "gzip",
            "Content-Length",
            "206",
            "Content-Type",
            "application/json; charset=UTF-8",
            "Date",
            "Fri, 16 Sep 2022 13:37:57 GMT",
            "Server",
            "Appwrite",
            "X-Content-Type-Options",
            "nosniff",
            "X-Debug-Fallback",
            "true",
            "X-Debug-Speed",
            "0.016963958740234",
            "X-Ratelimit-Limit",
            "120",
            "X-Ratelimit-Remaining",
            "118",
            "X-Ratelimit-Reset",
            "1663335480",
            "Connection",
            "close",
        ],
    );
